package com.mutual.controller.login;

import java.io.IOException;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.mutual.entity.Member;
import com.mutual.service.IMemberServer;


@Controller
@RequestMapping("/login")
public class LoginController {

	@Resource
	private IMemberServer memberService;
	
	@RequestMapping("/login.htm")
	public ModelAndView login(){
		return new ModelAndView("/login/login");
	}
	
	@RequestMapping("/doLogin.htm")
	public ModelAndView chek(HttpServletResponse resp,Member item) throws IOException{
		ModelAndView mav = new ModelAndView("jsonView");
		String name = item.getName();
		String pwd = item.getPassword();
		//Member member = memberService.login(item);
		if(StringUtils.equals(pwd, "asdf") && StringUtils.equals(name,"qwer")){
			mav.addObject("status",0);
		}else{
			mav.addObject("status",1);
		}
		return mav;
	}
	
	
}
